home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio / Ham Radio CD-ROM (Emerald Software) (1995).ISO / tech / bd / bd.pas < prev    next >
Pascal/Delphi Source File  |  1989-12-28  |  19KB  |  575 lines

  1. Program Bearing_Distance;                                       {BD.pas}
  2.  
  3.  
  4.  
  5. { This program written by Bob Wagner, N6DUR.  Algorithms were utilized
  6.   from the ARRL Antenna Handbook.  Latitude and Longitude data was provided
  7.   by W6SAS, KD4FR, & other sources. To modify for use at your location(QTH),
  8.   you will need a Turbo Pascal or compatible compiler, and must change the
  9.   items marked with arrows below in the Main Program BD.PAS, and  perform
  10.   a build (compile all units and main program).  As it stands, its good  for
  11.   San Diego, Calif.  Color displays  are used;  however, it will run momo-
  12.   chrome or color.  Feel free to change colors to suit your self }
  13.  
  14.  
  15. { Locations with latitude, longitude, and time correction from UTC,
  16.   are in Pascal Units GETINFO1, GETINFO2 AND GETINFO3. Locations may
  17.   be easily added, modified or deleted.  Additions should be made to
  18.   Unit GETINFO3 only, since there is a compiler size limitation for
  19.   these IF THEN ELSE IF statements of some sort, and you'll get a
  20.   compiler error and an erroneous report. }
  21.  
  22.  
  23. { This Turbo Pascal 5.5 Program computes Great Circle bearings and
  24.   distances to any place in the world and  calculates Local/UTC time
  25.   for selected locations stored in the program.
  26.  
  27.   A DX/Station prefix, K1-K0, or Major  city may be entered with a
  28.   <CR> to generate this information. If a <CR> alone is entered, a
  29.   Latitude and Longitude must be provided to generate a Great Circle
  30.   bearing and distance to the location; no time information is furnished
  31.   in this case.  A Minutes to 100th Degree, i.e. , 15 Minutes = .25 Deg,
  32.   conversion chart is provided on screen.  }
  33.  
  34. { Since a DX Prefix like FR can be more than one specific location,
  35.   liberty was taken in listing this type of prefix as follows:
  36.  
  37.   "Location is Juan De Nova|Glorioso -11,-48 Reunion -21.1 -55.6",
  38.    which indicates the location/time indicated is for Juan De Nova,
  39.    but two other locations exist for this DX Prefix, Glorioso island at
  40.    11 Degrees South Latitude and 48 Degrees East Longitude, and
  41.    Reunion Island at 21.1 Degrees South Latitude and 55.6 East
  42.    Longitude.  To find the bearing and distance information for these
  43.    other locations, the appropriate Latitude/Longitude must be entered.
  44.  
  45.    Another liberty was also taken, i.e., in the case of DX Prefixes
  46.    like DA - DP, the Federal Republic of Germany.  Only the current
  47.    prefixes are available.  If the first one is entered, however,
  48.    the other prefixes are shown. Of course the user can add any new
  49.    prefixes to the program as needed. }
  50.  
  51.  
  52.   {Bearing_Distance (BD.pas) is the Main Program and must be compiled with
  53.    the following Turbo 5.5 Pascal Units available:
  54.  
  55.          SYSDD.PAS ----->  Global Data Design
  56.          GETINFO1.PAS ---> Procedure Get_DX_Info1 (Prefix Data)
  57.          GETINFO2.PAS ---> Procedure Get_DX_Info2 (Prefix Data)
  58.          GETINFO3.PAS ---> Procedure Get_Dx_Info3 (City & New Prefix Data)
  59.          BDLIB.PAS ----->  Function Upper_Case
  60.          FINDTIME.PAS -->  Procedure Find_Local_Time
  61.          SETWIND.PAS --->  Procedure SetWindow           }
  62.  
  63.  
  64. {$E+}       {8087 Emulation.  No!, You don't need an 8087 Chip}
  65. {$N+}
  66.  
  67. Uses CRT,DOS,GetInfo1,GetInfo2,GetInfo3,SysDD,FindTime,BDLib,SetWind;
  68.  
  69. { - - - - - - - - - - - - - Declarations - - - - - - - - - - - - - - - - - }
  70.  
  71. Label
  72.  
  73.   Start,Continue,Skip1,Skip2;
  74.  
  75. Const
  76.  
  77.   K  = 111.11;             {ARC TO KILOMETERS}
  78.   N  = 60;                 {ARC TO NAUTICAL MI.}
  79.   S  = 69.041;             {ARC TO STATUTE MI.}
  80.   A  = 32.8167;   {SET FOR LATITUDE AT YOUR QTH    <----- Change for QTH  }
  81.   L1 = 117.2083;  {SET FOR LONGITUDE AT YOUR QTH   <----- Change for QTH  }
  82.   M  = 57.29577951308238; {180/PI - DEGREES TO RADIANS}
  83. PIO2 = 1.57079; {PI/2}
  84. Esc  = #27; {Escape Key}
  85.  
  86.  X1  = 9;  {Window Size;Small Window}
  87.  Y1  = 9;
  88.  X2  = 73;
  89.  Y2  = 15;
  90.  
  91.  X3  = 2;  {Window Size; Large Window}
  92.  Y3  = 2;
  93.  X4  = 78;
  94.  Y4  = 23;
  95.  
  96. Var
  97.  
  98.   A1,             {YOUR LATITUDE IN RADIANS}
  99.   B1,             {OTHER STATION LATITUDE IN RADIANS}
  100.   C,              {GREAT CIRCLE BEARING }
  101.   RC,             {RECIPROCAL GREAT CIRCLE BEARING}
  102.   D,              {DEGREES OF ARC}
  103.   E,              {INTERMEDIATE VALUE}
  104.   L,              {DIFFERENCE IN LONGITUDES/M}
  105.   SDistance,       {STATUTE MILES}
  106.   KDistance,       {Kilometers}
  107.   NDistance : Double;  {Nautical Miles}
  108.   Ans : Char;
  109.   BString   : String[10];
  110.   L2String  : String[10];
  111.   ErrorCode : Integer;
  112.  
  113.  
  114. Begin {Main Program}
  115.  
  116.  
  117. Repeat  { Until ANS = Yes or No }
  118.  
  119. TextBackground(Blue);
  120. TextColor(Yellow);
  121. ClrScr;
  122. SetWindow(X1,Y1,X2,Y2);
  123. TextColor(LightRed);
  124. Writeln(' * THIS PROGRAM CALCULATES GREAT CIRCLE DISTANCES AND BEARINGS *');
  125. Writeln;
  126. Writeln;
  127. Write('           '); {Space over before reverse video set}
  128. TextBackground(White);
  129. TextColor(Black);
  130. Write('Is Your QTH On DayLight Savings Time? Y/N ');
  131. Ans := ReadKey;
  132.  
  133.  
  134. Until Ans In ['Y','y','N','n'];
  135.  
  136.  
  137. If Ans IN ['Y','y'] Then
  138.  
  139. { Change this to your QTH's Daylight Savings Time correction}
  140.  
  141.   Your_Time_Corr := 7  { <------------  Your DST Correction }
  142. Else
  143.  
  144. { Change this to your QTH's Local time correction }
  145.  
  146.   Your_Time_Corr := 8; { <------------  Your Local Time Correction }
  147.  
  148.  
  149. Window(1,1,80,25);
  150.  
  151. Start: {Label}
  152.  
  153.  
  154. Repeat
  155.   TextBackground(Blue);
  156.   TextColor(Yellow);
  157.   ClrScr;
  158.   SetWindow(X1,Y1,X2,Y2+1);
  159.   TextBackGround(Cyan);
  160.   TextColor(Black+Blink);
  161.   GoToXY(40,8);
  162.   Write('< Enter QUIT To Exit >');
  163.   TextBackground(Blue);
  164.   GoToXY(1,1);
  165.   TextColor(LightRed);
  166.   Writeln(' * THIS PROGRAM CALCULATES GREAT CIRCLE DISTANCES AND BEARINGS *');
  167.   Writeln;
  168.   Writeln;
  169.   Write('   '); {Space over before inverse video}
  170.   TextBackground(White);
  171.   TextColor(Black);
  172.   Writeln('Enter DX Prefix, K1-K0, Major U.S. City, Or Press <Return>');
  173.   TextBackground(Blue);
  174.   Write('   '); {Space over before inverse video}
  175.   TextBackground(White);
  176.   Write('To Enter Lat/Long: ');
  177.   Readln(Prefix);
  178.   Window(1,1,80,25);
  179.   TextBackground(Blue);
  180.   TextColor(Yellow);
  181.   ClrScr;
  182.   Prefix := Upper_Case(Prefix); {Change Prefix to Upper case if necessary}
  183.   If Prefix = 'QUIT' Then
  184.     Begin
  185.     TextBackground(Blue);
  186.     TextColor(White);
  187.     Exit;
  188.     End;
  189.   First_Ltr_Prefix := Prefix; {Stores first capital ltr of Prefix}
  190.   Writeln;
  191.   SetWindow(X3,Y3,X4,Y4);  {Produce large yellow framed window}
  192.  
  193.   GoToXY(2,2);
  194.  
  195.   If Prefix = '' Then   { If only <Return> Pressed, the BD Program assumes
  196.                            your entering a position, i.e., Lat/Long Entry}
  197.  
  198.  
  199.     Begin
  200.  
  201.              { Put up conversion chart in lower area of display window }
  202.  
  203.     TextBackground(Brown);
  204.     TextColor(Black);
  205.     GoToXY(15,8);
  206.     Writeln('* * *  MINUTES TO 100TH DEGREE CONVERSION  * * * ');
  207.     GoToXY(10,9);
  208.     Writeln;
  209.     GoToXY(10,10);
  210.     Writeln('Min.   0   5   10  15  20  25  30  35  40  45  50  55  60 ');
  211.     GoToXY(10,11);
  212.     Writeln('       .   .   .   .   .   .   .   .   .   .   .   .   .  ');
  213.     GoToXY(10,12);
  214.     Writeln;
  215.     GoToXY(10,13);
  216.     Writeln('Deg.   0   8   17  25  33  42  50  58  67  75  83  92  100 ');
  217.     GoToXY(10,14);
  218.     Writeln('       .   .   .   .   .   .   .   .   .   .   .   .   .   ');
  219.  
  220.  
  221.     Window(2,2,78,10);  { Set up small working window for Lat/Long entry,
  222.                          leaving Min/Deg Conversion Chart alone}
  223.     GoToXY(1,2);
  224.     TextBackground(Blue);
  225.     TextColor(LightRed);
  226.     Writeln('  - Enter Negative Values For Southerly Latitudes and Easterly Longitudes -');
  227.     Writeln;
  228.     Write('              '); {Space over before highlight}
  229.     TextBackground(White);
  230.     TextColor(Black);
  231.     Write('Enter Other Stations  Latitude, i.e.,  36.25:  ');
  232.  
  233.                   { Ensure correct input of Latitude}
  234.  
  235. {$I-}
  236.    Repeat
  237.      Readln(Bstring);
  238.      Val(Bstring,B,Errorcode);
  239.      If (ErrorCode <> 0) OR (B > 90.00) OR ( B < -90.00 ) Then
  240.       Begin
  241.        Write(Chr(7));
  242.        Window(16,5,68,5);  {Set window to clear all of last entry}
  243.        ClrScr;
  244.        Window(2,2,78,10);   {Set back to working window}
  245.        GoToXY(15,4); { Noted had to be here empirically}
  246.        Write('Enter Other Stations  Latitude, i.e.,  36.25:  ');
  247.       End;
  248.    Until (ErrorCode = 0) AND ( B <= 90.00 ) AND ( B >= -90.00 );
  249. {$I+}
  250.  
  251.  
  252.                   {Ensure Longitude Data Input Correct}
  253.  
  254.     TextBackGround(Blue);
  255.     Write('              '); {Space over to highlight}
  256.     TextBackground(White);
  257.     TextColor(Black);
  258.     Write('Enter Other Stations Longitude, i.e., 117.50: ');
  259. {$I-}
  260.   Repeat
  261.     Readln(L2String);
  262.     Val(L2String,L2,ErrorCode);
  263.     If (ErrorCode <> 0) OR (L2 > 180.00) OR ( L2 < -180.00 ) Then
  264.       Begin
  265.       Write(Chr(7));
  266.       Window(16,6,68,6);
  267.       ClrScr;
  268.       Window(2,2,78,10);
  269.       GoToXY(15,5);
  270.       Write('Enter Other Stations Longitude, i.e., 117.50: ');
  271.       End;
  272.    Until (ErrorCode = 0) AND (L2 <= 180.00) AND ( L2 >= -180.00 );
  273. {$I+}
  274.  
  275.       TextBackground(Blue);
  276.       Window(2,9,78,15);  {Clear only the Min/Deg Conversion Chart}
  277.       ClrScr;
  278.       Window(2,2,79,24);  {Reestablish entire screen inside window to write}
  279.       GoToXY(1,7);  {Goto line 8 to write the Bearing/Distance Data}
  280.       TextColor(Yellow);
  281.  
  282.     End   {of If Prefix = '' Then}
  283.  
  284.   Else    {Beginning of Else portion of above.  This is done if user enters
  285.            a DX Prefix, Major City, or K1 - K0.  Note: K1 - K0 is used when
  286.            only a rough indication of possible location is desired. }
  287.  
  288.     Begin
  289.     Get_DX_Info1;      { Go Look For DX Prefix, Major City, or K1 -K0 }
  290.     If Not_Found Then
  291.       Begin
  292.       Get_DX_Info2;
  293.       If Not_Found Then
  294.         Begin
  295.         Get_Dx_Info3;
  296.         If Not_Found Then
  297.           Begin
  298.           ClrScr;
  299.           Write('            ');
  300.           TextBackground(White);
  301.           TextColor(Black);
  302.           Write('Prefix Or City Not Found;  Press <Return> To Continue: ');
  303.           Readln;
  304.           If (First_Ltr_Prefix = 'U') OR (First_Ltr_Prefix = 'R') Then
  305.             Begin
  306.             TextBackground(Blue);
  307.             ClrScr;
  308.             TextBackground(White);
  309.             TextColor(Black);
  310.             GoToXY(19,1);
  311.             Write('USSR/Russian Prefix Entered And Not Found:');
  312.             GoToXY(12,2);
  313.             Writeln;
  314.             GoToXY(12,3);
  315.             Writeln('1.  Try Again With/Without The Numeral');
  316.             GOToXY(12,4);
  317.             Writeln;
  318.             GoToXY(12,5);
  319.             Writeln('2.  If "R" Prefix Entered, Re-enter Using "U" Prefix.');
  320.             GoToXY(25,7);
  321.             TextBackGround(Cyan);
  322.             TextColor(Black+Blink);
  323.             Write('Press <Return> To Continue: ');
  324.             Readln;
  325.  
  326.             End;
  327.  
  328.           If (First_Ltr_Prefix = 'D') Then
  329.             Begin
  330.             TextBackground(Blue);
  331.             ClrScr;
  332.             TextBackground(White);
  333.             TextColor(Black);
  334.             GoToXY(19,1);
  335.             Write('West German Prefix Entered And Not Found:');
  336.             GoToXY(12,2);
  337.             Writeln;
  338.             GoToXY(30,3);
  339.             Writeln('Try Again With "DA"');
  340.             GoToXY(25,5);
  341.             TextBackGround(Cyan);
  342.             TextColor(Black+Blink);
  343.             Write('Press <Return> To Continue: ');
  344.             Readln;
  345.  
  346.             End;
  347.           TextBackground(Blue);
  348.           Window(1,1,80,25);
  349.           ClrScr;
  350.           GoTo Start;
  351.           End;
  352.         End;
  353.       End;
  354.     End;
  355.  
  356.   If Prefix <> '' Then     {Enter here if a prefix is entered, and if it was
  357.                             K1 - K0, then  jump over any time display work }
  358.  
  359.  
  360.     Begin
  361.     If          Prefix = 'K1' Then
  362.                 GoTo Skip1
  363.     Else If     Prefix = 'K2' Then
  364.                 GoTo Skip1
  365.     Else If     Prefix = 'K3' Then
  366.                 GoTo Skip1
  367.     Else If     Prefix = 'K4' Then
  368.                 GoTo Skip1
  369.     Else If     Prefix = 'K5' Then
  370.                 GoTo Skip1
  371.     Else If     Prefix = 'K6' Then
  372.                 GoTo Skip1
  373.     Else If     Prefix = 'K7' Then
  374.                 GoTo Skip1
  375.     Else If     Prefix = 'K8' Then
  376.                 GoTo Skip1
  377.     Else If     Prefix = 'K9' Then
  378.                 GoTo Skip1
  379.     Else If     Prefix = 'K0' Then
  380.                 GoTo Skip1
  381.     Else
  382.  
  383.     Write('    ');
  384.     Textbackground(White);
  385.     TextColor(Black);
  386.     Write('< *Location;  Add 1/2 Hour >');
  387.     TextBackground(Blue);
  388.     Write('       ');
  389.     Textbackground(White);
  390.     TextColor(Black);
  391.     Writeln('< Location On DST; Add 1 Hour >');
  392.     TextBackground(Blue);
  393.     TextColor(Yellow);
  394.     Writeln;
  395.     Skip1: {Label}
  396.     Writeln('    Location Is ',Country);           {Country, US Call Area}
  397.                                                  {Location, Or US City }
  398.  
  399.  
  400.  
  401.     If          Prefix = 'K1' Then    {Jump over any time computations}
  402.                 GoTo Skip2
  403.     Else If     Prefix = 'K2' Then
  404.                 GoTo Skip2
  405.     Else If     Prefix = 'K3' Then
  406.                 GoTo Skip2
  407.     Else If     Prefix = 'K4' Then
  408.                 GoTo Skip2
  409.     Else If     Prefix = 'K5' Then
  410.                 GoTo Skip2
  411.     Else If     Prefix = 'K6' Then
  412.                 GoTo Skip2
  413.     Else If     Prefix = 'K7' Then
  414.                 GoTo Skip2
  415.     Else If     Prefix = 'K8' Then
  416.                 GoTo Skip2
  417.     Else If     Prefix = 'K9' Then
  418.                 GoTo Skip2
  419.     Else If     Prefix = 'K0' Then
  420.                 GoTo Skip2
  421.     Else
  422.  
  423.  
  424.     Find_Local_Time;         { Call to get other stations local time }
  425.  
  426.     { Account for less than 10 hour & 10 Minute situation; add 0 before }
  427.  
  428.          If (OtherHour < 10) AND (YourMinute < 10) Then
  429.            Writeln('    Local Time Here Is 0',OtherHour,':0',YourMinute)
  430.  
  431.     Else If (OtherHour <10) AND (YourMinute >= 10) Then
  432.            Writeln('    Local Time Here Is 0',OtherHour,':',YourMinute)
  433.  
  434.     Else If (OtherHour >= 10) AND (YourMinute < 10) Then
  435.            Writeln('    Local Time Here Is ',OtherHour,':0',YourMinute)
  436.  
  437.     Else                           { OtherHour >= 10 AND YourMinute >= 10 }
  438.       Writeln('    Local Time Here Is ',OtherHour,':',YourMinute);
  439.  
  440.  
  441.     { Account for less than 10 hour & 10 Minute situation; add 0 before }
  442.  
  443.          If (UTCHour < 10) AND (YourMinute < 10) Then
  444.            Writeln('    UTC Time For The Log Is 0',UTCHour,':0',YourMinute)
  445.  
  446.     Else If (UTCHour <10) AND (YourMinute >= 10) Then
  447.            Writeln('    UTC Time For The Log Is 0',UTCHour,':',YourMinute)
  448.  
  449.     Else If (UTCHour >= 10) AND (YourMinute < 10) Then
  450.            Writeln('    UTC Time For The Log Is ',UTCHour,':0',YourMinute)
  451.  
  452.     Else                           { UTCHour >= 10 AND YourMinute >= 10 }
  453.  
  454.      Writeln('    UTC Time For The Log Is ',UTCHour,':',YourMinute);
  455.  
  456.  
  457.                       {Generate Time/Date at QTH}
  458.  
  459.          If (YourHour < 10) AND (YourMinute < 10) Then
  460.            Write('    Time And Date At Your QTH Is 0',YourHour,':0',YourMinute)
  461.  
  462.     Else If (YourHour <10) AND (YourMinute >= 10) Then
  463.            Write('    Time And Date At Your QTH Is 0',YourHour,':',YourMinute)
  464.  
  465.     Else If (YourHour >= 10) AND (YourMinute < 10) Then
  466.            Write('    Time And Date At Your QTH Is ',YourHour,':0',YourMinute)
  467.  
  468.     Else                           { YourHour >= 10 AND YourMinute >= 10 }
  469.       Write('    Time And Date At Your QTH Is ',YourHour,':',YourMinute);
  470.  
  471.     GetDate(MyYear,MyMonth,MyDay,MyDayOfWeek);
  472.  
  473.     Case MyMonth Of
  474.     1 : MyMonthStr := 'Jan';
  475.     2 : MyMonthStr := 'Feb';
  476.     3 : MyMonthStr := 'Mar';
  477.     4 : MyMonthStr := 'Apr';
  478.     5 : MyMonthStr := 'May';
  479.     6 : MyMonthStr := 'Jun';
  480.     7 : MyMonthStr := 'Jul';
  481.     8 : MyMonthStr := 'Aug';
  482.     9 : MyMonthStr := 'Sep';
  483.     10: MyMonthStr := 'Oct';
  484.     11: MyMonthStr := 'Nov';
  485.     12: MyMonthStr := 'Dec';
  486.     End; {of case}
  487.  
  488.     Case MyDayOfWeek Of
  489.     0 : MyDayOfWeekStr := 'Sun';
  490.     1 : MyDayOfWeekStr := 'Mon';
  491.     2 : MyDayOfWeekStr := 'Tue';
  492.     3 : MyDayOfWeekStr := 'Wed';
  493.     4 : MyDayOfWeekStr := 'Thu';
  494.     5 : MyDayOfWeekStr := 'Fri';
  495.     6 : MyDayOfWeekStr := 'Sat';
  496.     End; {of case}
  497.  
  498.    Writeln(' ',MyDayOfWeekStr,' ',MyMonthStr,' ',MyDay,',',MyYear);
  499.  
  500.    End;
  501.  
  502.  
  503.  
  504.   Skip2: {Label}
  505.  
  506.           {General computations provided by ARRL ANTENNA HANDBOOK}
  507.  
  508.   A1 := A/M; {Your latitude in radians}
  509.   B1 := B/M; {Latitude in radians}
  510.   Writeln;
  511.   Writeln;
  512.   Write('                        ');
  513.   TextColor(LightRed);
  514.   Writeln('G R E A T  C I R C L E  D A T A ');
  515.   TextColor(Yellow);
  516.   Writeln('   ========================================================================');
  517.   L := (L1-L2)/M; {Difference in Longitude in radians}
  518.   E := SIN(A1) * SIN(B1) + COS(A1) * COS(B1) * COS(L);
  519.   D := -ArcTan(E/SQRT( 1 - E*E )) + PIO2;
  520.   C := ( SIN(B1) - SIN(A1) * E ) / ( COS(A1) * SIN(D) );
  521.  
  522.   If C >= 1 Then
  523.     Begin
  524.     C := 0;
  525.     GoTo Continue;
  526.     End;
  527.  
  528.   If C <= -1 Then
  529.     Begin
  530.     C := 180/M;
  531.     GoTo Continue;
  532.     End;
  533.  
  534.   C := -ArcTan( C/SQRT(1 - C * C) ) + PIO2;
  535.  
  536. Continue: {Label}
  537.   C := C * M;
  538.   If SIN(L) <0 Then
  539.     C := 360 - C;
  540.  
  541.   If C + 180 >= 360 Then      {Compute Reciprocal Bearing}
  542.     RC := (C + 180) - 360
  543.   Else
  544.     RC := C + 180;
  545.   If Prefix <> '' Then
  546.     Begin
  547.     Write('   ');
  548.     TextBackground(White);
  549.     TextColor(Black);
  550.     Writeln('<DX Prefix Or City: ',Prefix,'>');
  551.     TextBackGround(Blue);
  552.     TextColor(Yellow);
  553.     End;
  554.   Writeln;
  555.   Writeln('              The Great Circle Bearing From Your QTH: ',C:3:1,' Degrees');
  556.   Writeln('                          Long Path Or From His  QTH: ',RC:3:1,' Degrees');
  557.   Writeln;
  558.   SDistance := (S * D * M); {  Use S for statute miles, N for Nautical,  }
  559.   KDistance := (K * D * M); {  & K for Kilometers                        }
  560.   NDistance := (N * D * M);
  561.   Writeln('              The Great Circle Distance is: ',NDistance:6:1,' Nautical Miles');
  562.   Writeln('                                            ',SDistance:6:1,' Statute  Miles');
  563.   Writeln('                                            ',KDistance:6:1,' Kilometers');
  564.   Writeln;
  565.   Write('                  ');
  566.   TextBackground(Cyan);
  567.   TextColor(Black+Blink);
  568.   Write('Press <Enter> To Continue Or Esc To Quit: ');
  569.   Ans := ReadKey;
  570.   Window(1,1,80,25);
  571.  
  572. Until Ans = Esc;
  573. TextBackground(Blue);
  574. ClrScr;
  575. End.     {Main Program}